Communication Device

ABSTRACT

An MFP establishes a first communication link L 1  by receiving an activation command and sending an OK command. The MFP receives first target data from a portable device by using the first communication link. The MFP generates second target data by processing the first target data. After receiving the first target data, the MFP disconnects the first communication link. The MFP establishes a second communication link by receiving the activation command and sending the OK command. The MFP sends the second target data to the portable device by using the second communication link.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims priority to Japanese Patent Application No. 2012-082819, filed on Mar. 30, 2012, the contents of which are hereby incorporated by reference into the present application.

TECHNICAL FIELD

The technology disclosed in the present specification relates to a communication device that communicates target data that is a target of communication, with an external device according to an NFC (an abbreviation of Near Field Communication) scheme, which is a communication scheme complying with an NFC standard.

DESCRIPTION OF RELATED ART

A conventional technology used for executing wireless communication by two communication devices has been known. In this technology, the two communication devices communicate communication information wirelessly according to the NFC scheme. The communication information includes information used for executing the wireless communication according to a communication scheme (such as IEEE 802.11a) different from the NFC scheme (i.e., information indicating the communication scheme, information indicating an encryption scheme). With this technology, the two communication devices can execute the wireless communication in accordance with the communication scheme different from the NFC scheme.

SUMMARY

The present specification provides a technology for allowing a communication device to appropriately communicate target data that is a target of communication, with an external device according to the NFC scheme.

In one aspect of the teachings disclosed herein, a communication device configured to communicate target data that is a target of communication with an external device according to an NFC (Near Field Communication) scheme may be provided. The NFC scheme may be a scheme complying with an NFC standard. The communication device may comprise an NFC interface configured to execute NFC scheme communication; a processor; and a memory configured to store a computer program. According to the computer program, the processor may be configured to execute a first establishing step, a first communicating step, a disconnecting step, a second establishing step, and a second communicating step. The first establishing step communicates a first establishing command with the external device via the NFC interface so as to establish a first communication link between the communication device and the external device. The first communicating step may communicate first target data with the external device via the NFC interface by using the first communication link. The disconnecting step may disconnect the first communication link after communicating the first target data with the external device. The second establishing step may communicate a second establishing command with the external device via the NFC interface after disconnecting the first communication link, so as to establish a second communication link between the communication device and the external device. The second communicating step may communicate second target data with the external device via the NFC interface by using the second communication link, the second target data being data generated by processing the first target data.

A non-transitory computer-readable storage medium storing a computer program for a communication device configured to communicate target data that is a target of communication with an external device according to an NFC scheme is also novel and useful.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 shows a configuration of a communication system;

FIG. 2 shows a flowchart of a Listen-process of MFP;

FIG. 3 shows a flowchart following the one shown in FIG. 2;

FIG. 4 shows a flowchart of a Poll-process of MFP;

FIG. 5 shows a flowchart following the one shown in FIG. 4;

FIG. 6 shows a sequence chart of a case A1, which is an example of communication in a P2P-mode;

FIG. 7 shows a sequence chart of a case A2, which is an example of communication in a P2P-mode;

FIG. 8 shows a sequence chart of a case A3, which is an example of communication in a P2P-mode;

FIG. 9 shows a sequence chart of a case A4, which is an example of communication in a P2P-mode;

FIG. 10 shows a sequence chart of a case B1, which is an example of communication in a R/W-mode and communication in a CE-mode;

FIG. 11 shows a sequence chart of a case B2, which is an example of communication in a R/W-mode and communication in a CE-mode; and

FIG. 12 shows a sequence chart of cases B3 to B8, which is an example of communication in a R/W-mode and communication in a CE-mode.

EMBODIMENT Configuration of Communication System 2

As shown in FIG. 1, a communication system 2 has a multi-function peripheral (“MFP,” hereinafter) 10 and a portable device 50. The MFP 10 and the portable device 50 are capable of executing communication in accordance with a communication scheme (i.e., an NFC scheme) complying with the NFC standard. In the present embodiment, the NFC standard is ISO/IEC 21481 or ISO/IEC 18092 international standard level. The NFC scheme communication is wireless communication using a radio wave of 13.56 MHz band. The MFP 10 and the portable device 50 are each capable of executing wire communication or wireless communication by using a communication network different from a communication link according to the NFC scheme.

Configuration of MFP 10

The MFP 10 has an operating unit 12, a display unit 14, a network interface (described as “I/F,” hereinafter) 16, a print executing unit 18, a scan executing unit 20, an NFC I/F 22, and a controller 30. The operating unit 12 has a plurality of keys. A user can input various instructions to the MFP 10 by operating the operating unit 12. The display unit 14 is a display for displaying various pieces of information. The network I/F 16 may be an I/F connected to a wired network or an I/F connected to a wireless network. Note that this wireless network is a network for executing wireless communication different from the NFC scheme communication, the network complying with, for example, an IEEE (an abbreviation of Institute of Electrical and Electronics Engineers, Inc.) 802.11 standard and a standard equivalent thereto (e.g., 802.11a, 11b, 11g, 11n). The print executing unit 18 is an inkjet or laser printing mechanism. The scan executing unit 20 is a scan mechanism such as a CCD or CIS.

The NFC I/F 22 is an interface for executing the NFC scheme communication. The NFC I/F 22 is configured by a chip different from the network I/F 16. Note that, in a case where the network I/F 16 is an I/F connected to a wireless network, the network I/F 16 and the NFC I/F 22 differ from each other in terms of the following points.

In other words, the speed of wireless communication using the network I/F 16 is higher than the speed of wireless communication using the NFC I/F 22. The frequency of a carrier wave in the wireless communication performed using the network I/F 16 is different from the frequency of a carrier wave in the wireless communication performed using the NFC I/F 22. When the distance between the MFP 10 and the portable device 50 is approximately 10 cm or less, the MFP 10 can execute the NFC scheme communication with the portable device 50 using the NFC I/F 22. On the other hand, even when the distance between the MFP 10 and the portable device 50 is equal to or greater than 10 cm, or equal to or less than 10 cm, the MFP 10 can execute the wireless communication with the portable device 50 using the network I/F 16. In other words, the maximum distance in which the MFP 10 can execute the wireless communication with a communication-destination device (e.g., the portable device 50) via the network I/F 16 is greater than the maximum distance in which the MFP 10 can execute the wireless communication with the communication-destination device via the NFC I/F 22. It should be noted that the wireless communication using the network I/F 16 is referred to as “network wireless communication” hereinafter.

The controller 30 has a CPU 32 and a memory 34. The CPU 32 executes various processes in accordance with programs 36, 38 stored in the memory 34. The memory 34 is configured by a ROM, a RAM, a hard disk, and the like. The memory 34 stores therein the programs 36, 38 that are executed by the CPU 32. The application program 36 is a program executed by the CPU 32 to process an application layer of the OSI reference model.

The protocol stack 38 is a program executed by the CPU 32 to process a layer lower than the application layer of the OSI reference model. Note that the protocol stack 38 includes a P2P (an abbreviation of Peer to Peer) program, a R/W program, and a CE program. The P2P program is a program for executing a process according to a P2P-mode of the NFC standard. The R/W program is a program for executing a process according to a Reader/Writer-mode of the NFC standard. The CE program is a program for executing a process according to a CE (an abbreviation of Card Emulation) mode of the NFC standard. These programs are used for executing processes complying with the NFC standards defined by the NFC forum.

The memory 34 also stores “0” or “1” as a sending flag. The sending flag indicates whether or not the MFP 10 is to send the target data that is a target of communication. Specifically, in a situation in which the MFP 10 is to send the target data, the sending flag is set at “1.” In a situation in which the MFP 10 is not to send the target data, the sending flag is set at “0.”

The memory 34 also stores “0” or “1” as a communication complete flag. As will be described hereinafter, the NFC scheme communication is performed between the MFP 10 and the portable device 50 where first target data is sent from one of the devices to the other, and thereafter NFC scheme communication is performed therebetween where second target data is sent from the other device to the one device. Hereinafter, this process of executing the communication of the first target data and thereafter the communication of the second target data is referred to as “one set of communication.” The communication complete flag indicates whether the first target data is communicated or not in the one set of communication. In other words, in a situation in which the first target data is communicated, the communication complete flag is set at “1.” In a situation in which the first target data is not communicated, the communication complete flag is set at “0.”

Configuration of Portable Device 50

The portable device 50 is, for example, a cellular phone (e.g., a smartphone), a PDA, a laptop, a tablet PC, a portable music reproducer, a portable video reproducer, or the like. The portable device 50 has the network I/F for connecting to the wireless network and the NFC I/F. The portable device 50 is capable of executing the wireless communication with the MFP 10 via either the network I/F or the NFC I/F.

The portable device 50 has an application program (“MFP application,” hereinafter) for causing the MFP 10 to execute various functions (e.g., a printing function, a scanning function, etc.). Note that the MFP application may be installed on the portable device 50 from, for example, a server provided by a vendor of the MFP 10 or installed on the portable device 50 from a medium shipped along with the MFP 10.

Target Data that is a Target of Communication

Various types of data can be considered as the first and second target data to be communicated in the one set of communication described above. Examples of the first and second target data are as follows.

First Example

A situation is simulated in which the MFP 10 is to receive print data from the portable device 50 to execute the printing function according to the print data. The user of the portable device 50 activates the MFP application of the portable device 50 and inputs to the portable device 50 an instruction for causing the MFP 10 to execute the printing function. In this case, the portable device 50 uses the NFC scheme communication to send the print execution instruction to the MFP 10. The print execution instruction does not include the print data.

The MFP 10 receives the print execution instruction from the portable device 50 via the NFC I/F 22. As mentioned above, the speed of the NFC scheme communication is lower than the speed of the network wireless communication. For this reason, if the NFC scheme communication is used for communicating the print data from the portable device 50 to the MFP 10, it might take a long time to communicate the print data. The present example, therefore, adopts a configuration in which the MFP 10 receives the print data from the portable device 50 by using the network wireless communication. In order to adopt such a configuration, the portable device 50 needs to know wireless settings for executing the network wireless communication with the MFP 10. Thus, when receiving the print execution instruction from the portable device 50, the MFP 10 sends a response including the wireless settings described above to the portable device 50 via the NFC I/F 22.

In this manner, the MFP 10 and the portable device 50 can communicate the print data by executing the network wireless communication in place of the NFC scheme communication. As a result, the MFP 10 can execute the printing function. In the present example, the print execution instruction and the response including the wireless settings are the examples of “first target data” and “second target data,” respectively.

Second Example

A situation is simulated in which the MFP 10 is to execute the scanning function scanning and generating scan data to send the scan data to the portable device 50. The user of the portable device 50 activates the MFP application of the portable device 50 and inputs to the portable device 50 an instruction for causing the MFP 10 to execute the scanning function. In this case, the portable device 50 uses the NFC scheme communication to send the scan execution instruction to the MFP 10.

The MFP 10 receives the scan execution instruction from the portable device 50 via the NFC I/F 22. Similarly to the first example mentioned above, if the NFC scheme communication is used for communicating the print data from the MFP 10 to the portable device 50, it might take a long time to communicate the scan data. The present example, therefore, adopts a configuration in which the MFP 10 sends the scan data to the portable device 50 by using the network wireless communication. Thus, when receiving the scan execution instruction from the portable device 50, the MFP 10 sends a response including the wireless settings to the portable device 50 via the NFC I/F 22.

In this manner, the MFP 10 and the portable device 50 can communicate the scan data by executing the network wireless communication in place of the NFC scheme communication. As a result, the MFP 10 can execute the scanning function. In the present example, the scan execution instruction and the response including the wireless settings are the examples of “first target data” and “second target data,” respectively.

Third Example

A situation is simulated in which the portable device 50 is to send, to the MFP 10, setting information to be used by the MFP 10. Examples of the setting information include print setting information used when the MFP 10 executes the printing function (e.g., print resolution, paper size, etc.), scan setting information used when the MFP 10 executes the scanning function (e.g., scanning resolution, etc.), and communication setting information used when the MFP 10 executes a communication function (e.g., an IP address, subnet mask, gateway address, etc.).

The user of the portable device 50 activates the MFP application of the portable device 50 and inputs to the portable device 50 the setting information to be used by the MFP 10. In this case, the portable device 50 sends the setting information to the MFP 10 by using the NFC scheme communication.

The MFP 10 receives the setting information from the portable device 50 via the NFC I/F 22. The MFP 10 stores the received setting information in the memory 34 as the setting information to be used by the MFP 10. Consequently, the MFP 10 can execute various functions by using the received setting information. When receiving the setting information from the portable device 50, the MFP 10 sends a response indicating the receipt of the setting information to the portable device 50 via the NFC I/F 22. In the present example, the setting information and the response are the examples of the “first target data” and the “second target data,” respectively.

Fourth Example

A situation is simulated in which the portable device 50 is to send, to the MFP 10, address information included in an address book that is currently used. The user of the portable device 50 activates the MFP application of the portable device 50 and inputs to the portable device 50 an instruction for sending the address information to the MFP 10. In this case, the portable device 50 sends the address information to the MFP 10 by using the NFC scheme communication.

The MFP 10 receives the address information from the portable device 50 via the NFC I/F 22. The MFP 10 adds the received address information to the address book currently used in the MFP 10 (i.e., the address book within the memory 34). Consequently, the MFP 10 can execute the communication function by using the received address information. When receiving the address information from the portable device 50, the MFP 10 sends a response indicating the receipt of the address information to the portable device 50 via the NFC I/F 22. In the present example, the address information and the response are the examples of the “first target data” and the “second target data,” respectively.

Fifth Example

The first example described above adopts a configuration in which the MFP 10 sends the print data to the portable device 50 by using the network wireless communication. Instead, for example, the MFP 10 may receive the print data from the portable device 50 via the NFC 22. In this case, the MFP 10 may send a response indicating the receipt of the print data to the portable device 50 via the NFC I/F 22. In the present example, the print data and the response are the examples of the “first target data” and the “second target data,” respectively.

Sixth Example

In the first to fifth examples described above, in the one set of communication the first target data is sent from the portable device 50 to the MFP 10 and then the second target data is sent from the MFP 10 to the portable device 50. However, in the one set of communication, the first target data may be sent from the MFP 10 to the portable device 50 and then the second target data may be sent from the portable device 50 to the MFP 10. For example, the MFP 10 may send scan data to the portable device 50 via the NFC I/F 22 and receive a response from the portable device 50 via the NFC I/F 22. In the present example, the scan data and the response are the examples of the “first target data” and the “second target data,” respectively.

Note that the combination of the “first target data” and the “second target data” is not limited to those described in the first to sixth examples and therefore may be a different combination. In other words, the “first target data” may be any type of data as long as the data is the target of communication, and the “second target data” may also be any type of data as long as the data (i.e., data different from the first target data) is generated by processing the first target data. It should be noted that a subject generating the second target data may be the MFP 10 or the portable device 50.

(Modes of NFC Standard)

Each of the modes adopted by the NFC standard is described next. According to the NFC standard, the P2P-mode, the Reader/Writer-Mode (simply described as “R/W-mode” hereinafter), and the CE-mode are used. Note that the devices capable of executing the NFC scheme communication (the MFP 10, the portable device 50, etc.) are referred to as “NFC devices,” hereinafter.

Among the NFC devices, there exists a device capable of using all of the three modes, as well as a device capable of using one or two of the three modes. In the present embodiment, the MFP 10 is the device capable of using all of the three modes. On the other hand, the portable device 50 may be capable of using all of the three modes or two of the three modes such as the R/W-mode and the CE-mode.

(P2P-Mode)

The P2P-mode is a mode for executing bidirectional communication between a pair of NFC devices. For example, a situation is simulated in which a first NFC device and a second NFC device are operated according to the P2P-mode. In this case, a communication link for executing communication according to the P2P-mode is established between the first NFC device and the second NFC device. For instance, the first NFC device sends data to the second NFC device by using the communication link. Subsequently, the second NFC device normally sends mother data to the first NFC device by using the same communication link. In this manner, the bidirectional communication is realized. While an NFC device, a tag type of which defined by the NFC forum is type A, and an NFC device of tag type F, can be operated according to the P2P-mode, an NFC device of tag type B cannot be operated according to the P2P-mode.

(R/W-Mode, CE-Mode)

The RAW-mode and the CE-mode are modes for executing unidirectional communication between a pair of NFC devices. The CE-mode is a mode in which each of the NFC devices is operated as a “card,” a format defined by the NFC forum. Thereinbelow, such a “card” may be termed a “pseudo card”. The NFC device of the tag type A, the NFC device of the tag type F, and the NFC device of the tag type B can be operated according to the CE-mode. The R/W mode is also classified into Reader- and Writer-modes. The Reader-mode is a mode for reading data from the NFC devices operated as the cards in the CE-mode. The Writer-mode is a mode for writing data into the NFC devices operated as the cards in the CE-mode. Note that, in the Reader-mode, the data can be read from a card complying with the NFC standard. Moreover, in the Writer-mode, data can be written into the card complying with the NFC standard.

For example, a situation is simulated in which the first NFC device is operated according to the Reader-mode and the second NFC device is operated according to the CE-mode. In this case, a communication link for executing communication according to the Reader-mode and the CE-mode is established between the first NFC device and the second NFC device. The first NFC device executes an operation for reading data from a pseudo card of the second NFC device, and thereby receives the data from the second NFC device.

For example, a situation is simulated in which the first NFC device is operated according to the Writer-mode and the second NFC device is operated according to the CE-mode. In this case, a communication link for executing communication according to the Writer-mode and the CE-mode is established between the first NFC device and the second NFC device. The first NFC device executes an operation for writing data in a pseudo card of the second NFC device, and thereby sends the data to the second NFC device.

As described above, various combinations of the modes can be considered in order for a pair of NFC devices to execute the NFC scheme communication. For example, the following five patterns can be considered as a combination of the modes of the MFP 10 and the portable device 50: “P2P-mode, P2P-mode,” “Reader-mode, CE-mode,” “Writer-mode, CE-mode,” “CE-mode, Reader-mode,” and “CE-mode, Writer-mode.”

(Poll-Operation and Listen-Operation)

The NFC devices are capable of executing a Poll-operation and a Listen-operation. More specifically, in the MFP 10, for example, instead of causing the CPU 32 to execute the Poll-operation and the Listen-operation in accordance with the programs 36, 38, the NFC I/F 22 executes the Poll-operation and the Listen-operation. The Poll-operation is an operation for sending a polling signal and receiving a response signal responsive to the polling signal. The Listen-operation is an operation for receiving a polling signal and sending a response signal responsive to the polling signal.

The NFC I/F 22 of the MFP 10 is capable of being operated in any of the following modes: a Poll-mode for executing the Poll-operation, a Listen-mode for executing the Listen-operation, and a mode for executing neither the Poll-operation nor the Listen-operation (referred to as “no-execution mode,” hereinafter). The NFC I/F 22 is operated in the Poll-mode, the Listen-mode, and the no-execution mode sequentially. For example, the NFC I/F 22 executes one set of operations in which the operations are performed in the Poll-mode, subsequently in the Listen-mode, and then in the no-execution mode. The NFC I/F 22 repeatedly executes this one set of operations.

In the Poll-mode, the NFC I/F 22 sends a polling signal and monitors receipt of a response signal. Specifically, the NFC I/F 22 (1) sends a polling signal to which the NFC device of the tag type A can respond a polling signal corresponding to the type A), and monitors receipt of a response signal for a predetermined period of time. (2) When not receiving the response signal, the NFC I/F 22 sends a polling signal to which the NFC device of the tag type B can respond (i.e., a polling signal corresponding to the type B), and monitors receipt of a response signal for a predetermined period of time. (3) When not receiving the response signal, the NFC I/F 22 sends a polling signal to which the NFC device of the tag type F can respond (i.e., a polling signal corresponding to the type F), and monitors receipt of a response signal for a predetermined period of time. The NFC I/F 22 repeats these operations. When the NFC I/F 22 receives the response signal from any of the NFC devices within a predetermined period of time, this NFC device is considered the type of NFC device corresponding to the polling signal that is received immediately before the response signal is sent. When receiving the response signal, the NFC I/F 22 further sends an inquiry signal to the NFC device to inquire in which mode the NFC device, to which the response signal is sent, can be operated. As a result, the NFC I/F 22 receives an operable mode signal from this NFC device. The operable mode signal indicates that the NFC device can be operated in the P2P-mode and the CE-mode or that the NFC device can be operated only in the CE-mode.

In the Listen-mode, the NFC I/F 22 monitors receipt of a polling signal, and, when receiving the polling signal, sends a response signal. Only when receiving the type of polling signal corresponding to the NFC I/F 22, the NFC I/F 22 sends a response signal to the NFC device that had sent the polling signal. When sending the response signal to the NFC device, the NFC I/F 22 receives the inquiry signal from the NFC device and sends the operable mode signal to the NFC device. In the no-execution mode, the NFC I/F 22 does not send a polling signal, and does not send a response signal even when a polling signal is received.

The portable device 50 also repeatedly executes the one set of operations described above. Therefore, when, for example, the distance between the MFP 10 and the portable device 50 is less than 10 cm and a period during which the NFC I/F 22 is operated in the Poll-mode is equivalent to a period during which the portable device 50 is operated in the Listen-mode, the NFC 22 executes the Poll-operation of sending a polling signal to the portable device 50 and receiving a response signal from the portable device 50. Furthermore, when, for example, the distance between the MFP 10 and the portable device 50 is less than 10 cm and a period during which the NFC I/F 22 is operated in the Listen-mode is equivalent to a period during which the portable device 50 is operated in the Poll-mode, the NFC I/F 22 executes the Listen-operation of receiving a polling signal from the portable device 50 and sending a response signal to the portable device 50.

Once the NFC I/F 22 executes the Poll-operation or the Listen-operation, each of processes required for performing the subsequent communication is succeeded to the CPU 32. Specifically, when the NFC I/F 22 of the MFP 10 executes the Poll-operation and the portable device 50 executes the Listen-operation, information indicating the operation of a certain mode that can be executed by the portable device 50 (i.e., information indicated by a receipt complete operable mode signal) is delivered from the NFC I/F 22 to the CPU 32. Based on the information delivered from the NFC I/F 22, the CPU 32 determines in which mode the MFP 10 is to be operated. Specifically, in a case where the MFP 10 can be operated in any of the modes and the receipt complete operable mode signal indicates the operability in the P2P-mode and the CE-mode, the CPU 32 determines that the MFP 10 is to be operated in the P2P-mode. In this case in a modification, the CPU 32 may determine that the MFP 10 is to be operated in the CE-mode. Moreover, when the MFP 10 can be operated in any of the modes and the receipt complete operable mode signal indicates the operability only in the CE-mode, the CPU 32 determines that the MFP 10 is to be operated in the R/W-mode. Suppose that the MFP 10 can be operated only in the R/W mode and that the receipt complete operable mode signal indicates the operability in the CE-mode, the CPU 32 determines that the MFP 10 is to be operated in the R/W-mode. Although described hereinafter in detail, the CPU 32 subsequently sends an activation command to the portable device 50. The activation command corresponds to the mode in which the MFP 10 is to be operated (i.e., the mode determined by the CPU 32) (see S112 in FIG. 4 and S160 in FIG. 5). The activation command is a command adopted according to the NFC standard and is used for establishing a communication link according to the NFC scheme between the MFP 10 and the portable device 50.

Note that the NFC device executing the Poll-operation (referred to as “Poll device,” hereinafter) can be operated in the P2P-mode and the R/W-mode in accordance with the NFC standard but cannot be operated in the CE-mode. Therefore, when the MFP 10 is the Poll device, the CPU 32 determines that the MFP 10 is to be operated in the P2P-mode or the R/W mode, as described above.

Or the other hand, when the NFC I/F 22 of MFP 10 executes the Listen-operation and the portable device 50 executes the Poll-operation, the CPU 32 receives the activation command from the portable device 50. The activation command corresponds to the mode in which the portable device 50 is to be operated (see S10 in FIG. 2). When receiving the activation command corresponding to the P2P-mode, the CPU 32 determines that the MFP 10 is to be operated in the P2P-mode. When receiving the activation command corresponding to the R/W-mode, the CPU 32 determines that the MFP 10 is to be operated in the CE-mode.

Note that the NFC device executing the Listen-operation (referred to as “Listen device,” hereinafter) can be operated in the P2P-mode and the CE-mode in accordance with the NFC standard but cannot be operated in the R/W-mode. Therefore, when the MFP 10 is the Listen device, the CPU 32 determines that the MFP 10 is to be operated in the P2P-mode or the CE-mode, as described above.

As long as the NFC I/F 22 executes the Poll-operation or the Listen-operation as described above, the CPU 32 can find out not only that the portable device 50 exists in the vicinity of the MFP 10, but also that in which mode the MFP 10 is to be operated. The CPU 32 then executes each of the processes required for performing the subsequent communication (see FIGS. 2 to 5 described hereinafter).

(Processes Executed by MFP 10; FIGS. 2 to 5)

Processes executed by the MFP 10 are described next with reference to FIGS. 2 to 5. Note that the CPU 32 executes each of the processes shown in FIGS. 2 to 5 in accordance with the programs 36, 38 stored in the memory 34. First of all, contents of processes that are executed by the CPU 32 when the NFC I/F 22 executes the Listen-operation (FIGS. 2 and 3; referred to as “Listen-process of MFP,” hereinafter) are described, and then contents of processes that are executed by the CPU 32 when the NFC 22 executes the Poll-operation (FIGS. 4 and 5; referred to as “Poll-process of the MIT,” hereinafter) are described.

(Listen-Process of MFP; FIGS. 2 and 3)

As described above, in a case where the NFC I/F 22 executes the Listen-operation (i.e., the portable device 50 executes the Poll-operation), the portable device 50 sends the activation command to the MFP 10. The activation command corresponds to the mode in which the portable device 50 is to be operated. In S10, the CPU 32 receives the activation command from the portable device 50 via the NFC I/F 22.

Next, in S12, the CPU 32 determines whether the MFP 10 is to be operated in the P2P-mode or the CE-mode. As described above, the MFP 10 is the NFC device capable of using all of the three modes: namely, the P2P-mode, the R/W-mode, and the CE-mode. On the other hand, the portable device 50 may be a device capable of using all of the three modes, or a device capable of using only the R/W-mode and the CE-mode. When receiving the activation command corresponding to the P2P-mode, the CPU 32 determines that the MFP 10 is to be operated in the P2P-mode (YES in S12 of FIG. 2) and proceeds to S14. On the other hand, when receiving the activation command corresponding to the R/W mode, the CPU 32 determines that the MFP 10 is to be operated in the CE-mode (NO in S12 of FIG. 2) and proceeds to S62 shown in FIG. 3.

(Listen-Process of MFP; P2P-Mode)

In S14, the CPU 32 sends a response command (i.e., an OK command) to the portable device 50 via the NFC I/F 22 responsive to the activation command. Consequently, the communication link according to the NFC scheme is established between the MFP 10 and the portable device 50. In other words, the CPU 32 can appropriately establish the communication link by receiving the activation command and sending the OK command.

Note that, in the Listen-process of MFP, the activation command cannot be sent from the MFP 10 to the portable device 50. This is because the Poll device can send the activation command, but the Listen device cannot send the activation command.

Next, in S16, the CPU 32 starts a confirming command responding process. A confirming command is sent from the Poll device to the Listen device to confirm whether or not to maintain the communication link. As described above, the MFP 10 is the Listen device and the portable device 50 the Poll device at the present moment. Thus, in the confirming command responding process, the CPU 32 receives the confirming command from the portable device 50 via the NFC I/F 22 and sends a response command (i.e., an OK command) to the portable device 50 via the NFC I/F 22 responsive to the confirming command.

Although not shown in the flowcharts, once the CPU 32 starts the confirming command responding process in S16, the CPU 32 continues the execution of the confirming command responding process until S38 described hereinafter is executed or until the communication link is disconnected in S44 described hereinafter.

Next, in S18, the CPU 32 determines whether the sending flag stored in the memory 34 is set at “1” or not. In the one set of communication described above, in a situation where the first target data is not communicated, the sending flag is normally set at “0.” For example, in the first to fifth examples relating to the target data, the first target data is sent from the portable device 50 to the MFP 10 and the second target data is sent from the MFP 10 to the portable device 50. In this case, in a situation in which the first target data is not communicated, the sending flag is normally set at “0.” As a result, the MFP 10 can receive the first target data from the portable device 50 (see S22 and the like). In addition, in such a case, in a situation in which the first target data is communicated, the sending flag is set at “1” (see S28 and the like). As a result, the MFP 10 can send the second target data to the portable device 50, as described hereinafter (see S32 and the like).

However, in the sixth example relating to the target data, the first target data is sent from the MFP 10 to the portable device 50 and the second target data is sent from the portable device 50 to the MFP 10. For instance, when the scan data (i.e., the first target data) is generated in accordance with the sixth example described above, the CPU 32 changes the sending flag from “0” to “1” in a process not shown in any of the flowcharts of FIGS. 2 to 5. In such a case, even in a situation in which the first target data is not communicated in the one set of communication described above, the sending flag is set at “1.” As a result, the MFP 10 can send the first target data to the portable device 50, as described hereinafter (see S32 and the like). Furthermore, in such a case, in a situation in which the first target data is communicated, the sending flag is set at “0” (see S36 and the like). As a result, the MFP 10 can receive the second target data from the portable device 50, as described hereinafter (see S22 and the like).

When the sending flag stored in the memory 34 is “1,” the CPU 32 determines that the result of S18 is YES and proceeds to S30. On the other hand, when the sending flag stored in the memory 34 is “0,” the CPU 32 determines that the result of S18 is NO and proceeds to S20.

In S20, the CPU 32 executes negotiation with the portable device 50 via the NFC I/F 22. Specifically, the CPU 32 first determines that the MFP 10 is operated as a client of the P2P-mode. The CPU 32 then executes communication according to a Simple NDEF Exchange protocol such that the MFP 10 is operated as the client and the portable device 50 as a server of the P2P-mode. Consequently, the portable device 50 is operated as the server that executes processes in response to requests from the client (i.e., the MFP 10). Note that NDEF is an abbreviation of “NFC Data Exchange Format.”

In S20, the CPU 32 further informs the portable device 50 that the MFP 10 executes data reception (i.e., that the portable device 50 executes data sending). This allows the portable device 50 to know that the target data is to be sent to the MFP 10, and sends the target data to the MFP 10. Hereinafter, “target data” may correspond to the first target data or the second target data described in any of the first to sixth examples relating to the target data.

Next, in S22, the CPU 32 receives the target data from the portable device 50 via the NFC I/F 22 by using the communication link established in S14.

Subsequently, in S24, the CPU 32 processes the target data received in S22. For instance, in the first or second example described above, the CPU 32 interprets a print execution instruction or scan instruction (i.e., the first target data) received in S22, to generate a response including wireless settings the second target data). Additionally, in the third example described above, for instance, the CPU 32 stores the setting information received in S22 (i.e., the first target data) in the memory 34 and generates a response indicating the receipt of the setting information (i.e., the second target data). In the fourth example described above, for instance, the CPU 32 adds address information received in S22 (i.e., the first target data) to an address book of the memory 34 and generates a response indicating the receipt of the address information (i.e., the second target data). In the fifth example described above, for instance, the CPU 32 executes the printing function in accordance with the print data received in S22 (i.e., the first target data) and generates a response indicating the receipt of the print data (i.e., the second target data).

For instance, in the sixth example described above, the CPU 32 interprets the response received in S22 (i.e., the second target data) and confirms that the portable device 50 has received the scan data. In this case, unlike ire the first to fifth examples described above, the CPU 32 does not execute the process for generating the second target data. In other words, the second target data is the data generated by the portable device 50.

Subsequently, in S26 the CPU 32 determines whether the communication complete flag stored in the memory 34 is set at “1” or not. When the communication complete flag stored in the memory 34 is “1,” the CPU 32 determines that the result of S26 is YES and proceeds to S40. When, on the other hand, the communication complete flag stored in the memory 34 is “0,” the CPU 32 determines that the result of S26 is NO and proceeds to S28.

In S28, the CPU 32 sets the sending flag stored in the memory 34 at “1” and sets the communication complete flag stored in the memory 34 at “1.” The CPU 32 then proceeds to S38 after S28 is ended.

In S38, the CPU 32 executes a disconnecting process for disconnecting the communication link established in S14. Two methods can be considered as a method for the disconnecting process of S38: a software-based disconnecting process and a hardware-based disconnecting process. The CPU 32 may execute either one of the methods for the disconnecting process.

In a case where the CPU 32 executes the software-based disconnecting process, the CPU 32 ends the confirming command responding process that is started in S16. In other words, even when the confirming command is received from the portable device 50, the CPU 32 does not send a response command (i.e., an OK command) responsive to the confirming command to the portable device 50. Therefore, the portable device 50 can find out that the MFP 10 does not wish to maintain the communication link, and sends to the MFP 10 a deactivation command to disconnect the communication link.

The CPU 32, therefore, receives the deactivation command from the portable device 50 via the NFC I/F 22. In this case, the CPU 32 sends a response command (i.e., an OK command), responsive to the deactivation command, to the portable device 50 via the NFC I/F 22. As a result, the communication link established in S14 is disconnected. The CPU 32 can appropriately disconnect the communication link by executing the software-based disconnecting process (ending the confirming command responding process, receiving the activation command, sending the OK command).

Note that the deactivation command cannot be sent from the MFP 10 to the portable device 50 in the Listen-process of MFP. This is because while the Poll device can send the deactivation command, the Listen device cannot send the deactivation command.

On the other hand, in a case where the CPU 32 executes the hardware-based disconnecting process, the CPU 32 temporarily stops the operations of the NFC I/F 22. More specifically, for example, the CPU 32 sends to the NFC I/F 22 an instruction for stopping the operations of the NFC I/F 22. Consequently, the NFC I/F 22 temporarily stops all of the operations including receiving/sending signals from/to the outside, the Poll-operation, and the Listen-operation. The CPU 32, therefore, can no longer use the NFC I/F 22 to execute the confirming command responding process that was started in S16.

Once the hardware-based disconnecting process is executed, the portable device 50 cannot receive a response command (i.e., an OK command) responsive to the confirming command, as with the case of the software-based disconnecting process. In this case, the portable device 50 sends the deactivation command to the MFP 10 but cannot receive a response command (i.e., an OK command) responsive to the deactivation command because the operations of the NFC I/F 22 of the MFP 10 are stopped. The portable device 50, therefore, determines this situation as a timeout and ends the process of maintaining the communication link (i.e., the process for sending the confirming command, etc.). As a result, the communication link established in S14 is disconnected. The CPU 32 can appropriately disconnect the communication link by executing the hardware-based disconnecting process (i.e., stopping the operations of the NFC I/F 22).

Note that the method of stopping the operations of the NFC I/F 22 is not limited to the method of sending the instruction from the CPU 32 to the NFC I/F 22 described above. For example, the CPU 32 may temporarily stop the operations of the NFC I/F 22 by temporarily stopping supplying power to the NFC I/F 22. This method is also an example of the hardware-based disconnecting process. Once S38 is ended, the Listen-process of MFP is ended.

On the other hand, when the result of S18 is YES (i.e., when the sending flag is “1”), in S30 the CPU 32 executes the negotiation, as with S20, such that the MFP 10 is operated as the client of the P2P-mode and the portable device 50 as the server of the P2P-mode. In S30, the CPU 32 also informs the portable device 50 of that the MFP 10 executes data sending (i.e., that the portable device 50 executes data reception). Consequently, the portable device 50 waits until receiving the target data from the MFP 10.

Next, in S32 the CPU 32 sends the target data to the portable device 50 via the NFC I/F 22 by using the communication link established in S14. For example, in the first to fifth examples described above, the CPU 32 processes the first target data to generate the second target data in, for example, S24 of the previous Listen-process of MFP or S124 of the previous Poll-process of MFP (FIG. 4). In this case, in S32 the CPU 32 sends the generated second target data to the portable device 50. Furthermore, in the sixth example described above, for instance, scan data is generated as the first target data. In this case, in S32 the CPU 32 sends the generated first target data to the portable device 50.

Next, in S34 the CPU 32 determines whether the communication complete flag stored in the memory 34 is set at “1” or not. When the communication complete flag stored in the memory 34 is set at “1,” the CPU 32 determines that the result of S34 is YES and proceeds to S40. When, on the other hand, the communication complete flag stored in the memory 34 is set at “0,” the CPU 32 determines that the result of S34 is NO and proceeds to S36.

In S36 the CPU 32 sets the sending flag stored in the memory 34 at “0” and the communication complete flag stored in the memory 34 at “L”. Once S36 is ended, the CPU 32 proceeds to S38 to execute the disconnecting process described above.

On the other hand, in S40 the CPU 32 sets the sending flag stored in the memory 34 at “0” and the communication complete flag stored in the memory 34 at “0”.

Note that, when S40 is executed (i.e., When the communication complete flag is set at “1”), communication of the second target data is completed (i.e., the one set of communication described above is completed). The portable device 50, therefore, determines that it is no longer necessary to maintain the communication link, and sends the deactivation command to the MFP 10. As a result, in S42 the CPU 32 receives the deactivation command from the portable device 50 via the NFC I/F 22.

Next, in S44 the CPU 32 sends a response command (i.e., an OK command) to the portable device 50 via the NFC I/F 22 responsive to the deactivation command. As a result, the communication link established in S14 is disconnected. Once S44 is ended, the Listen-process of MFP is ended.

(Listen-Process of MFP; CE-Mode (FIG. 3))

Contents of processes that are executed when the result of S12 of FIG. 2 is determined as NO (when it is determined that the MFP 10 is to be operated in the CE-mode) are described next with reference to FIG. 3. The step S62 is same as S14 shown in FIG. 2. Note that, when the MFP 10 is operated in the CE-mode and the portable device 50 is operated in the R/W-mode, the confirming code responding process (see S16 of FIG. 2) is not executed, unlike the case of the P2P-mode. This is because it is not necessary to confirm whether to maintain the communication link or not, since this mode is for unidirectional communication (i.e., the mode in which the target data is communicated only once).

The steps S64 to S72 are same as S18 and S22 to S28 shown in FIG. 2. The steps S74 to S78 are same as S32 to S36 shown in FIG. 2. The steps S86 to S90 are same as S40 to S44 shown in FIG. 2. Once S90 is ended, the Listen-process for MFP is ended.

In S80, the CPU 32 executes the software-based disconnecting process for disconnecting the communication link established in S62. In other words, the CPU 32 receives the deactivation command from the portable device 50 via the NFC I/F 22 and sends a response command (i.e., an OK command) to the portable device 50 via the NFC DE 22 responsive to the deactivation command. As a result, the communication link established in S62 is disconnected. The CPU 32 can appropriately disconnect the communication link by executing the software-based disconnecting process (receiving the deactivation command and sending the OK command).

Next, in S82 the CPU 32 executes an operation controlling process for controlling the operations of the NFC I/F 22. The CPU 32 sends an instruction for stopping the operations of the NFC I/F 22 to the NFC I/F 22. Consequently, the NFC I/F 22 temporarily stops all of the operations including receiving/sending signals from/to the outside, the Poll-operation, and the Listen-operation.

Once the communication link is disconnected in S80, the portable device 50 is operated again in the Poll-mode and the Listen-mode sequentially. However, because the operations of the NFC I/F 22 of the MFP 10 are temporarily stopped in S82, the portable device 50 does not receive a response signal even if the polling signal is sent. The portable device 50 also does not receive the polling signal from the MFP 10. For this reason, the portable device 50 can detect that the distance between the MFP 10 and the portable device 50 has increased, i.e., the communication counterpart has seceded.

The reasons that the portable device 50 is caused to detect the secession of the communication counterpart (i.e., that the operation controlling process is executed in S82) are as follows. The communication links corresponding to the CE-mode and the R/W-mode are established under the assumption that the target data is communicated only once. Thus, when a pair of NFC devices communicates the target data in accordance with the CE-mode and the R/W-mode, normally the communication link is disconnected. Subsequently, supposedly when the pair of NFC devices remains close to each other, the pair of NFC devices can execute the Poll-operation and the Listen-operation again, reestablish the communication link, and communicate the same target data. In other words, when the pair of NFC devices remains close to each other, the same target data is communicated for a number of times.

Therefore, when the secession of the communication counterpart is not detected after the communication links corresponding to the CE-mode and the R/W mode are disconnected, the NFC devices are normally programmed so as not to reestablish a communication link even upon executing the Poll-operation and the Listen-operation again. When, for example, the response signal is not received from the communication counterpart no matter how many times the polling signal is sent, or when the polling signal is not received from the communication counterpart for a predetermined period of time, the NFC devices detect the secession of the communication counterpart. By detecting the secession of the communication counterpart in this manner, the NFC devices can reestablish a communication link with the same communication counterpart.

In the present embodiment, communication of the second target data is executed (i.e., the one set of communication is executed) subsequent to the communication of the first target data. Therefore, it is necessary to adopt a mechanism for reestablishing a new communication link for communicating the second data, even when the MFP 10 and the portable device 50 remain close to each other after the communication link for communicating the first target data is disconnected. This mechanism is the operation controlling process of S82. In other words, by causing the MFP 10 to execute the operation controlling process of S82, the portable device 50 can detect secession of the MFP 10, even when the MFP 10 and the portable device 50 remain close to each other. Thereafter, a communication link can be reestablished between the MFP 10 and the portable device 50 as long as the MFP 10 and the portable device 50 execute the Poll-operation and the Listen-operation.

Note that the operation controlling process of S82 is not limited to the method of sending an instruction 1 mm the CPU 32 to the NFC I/F 22 described above. For instance, the CPU 32 may temporarily stop the operations of the NFC I/F 22 by temporarily stopping supplying power to the NFC I/F 22. This method is also an example of the operation controlling process. Once S82 is ended, the Listen-process of MFP is ended.

(Poll-Process of MFP; FIGS. 4 and 5)

Contents of the Poll-process of MFP are described hereinafter with reference to FIGS. 4 and 5. As described above, when the NFC 22 executes the Poll-operation, the MFP 10 is operated in either the P2P-mode or the R/W-mode in accordance with the received operable mode signal. In S110, based on the received operable mode signal, the CPU 32 determines whether the MFP 10 is to be operated in the P2P-mode or the R/W mode. When it is determined that the MFP 10 is to be operated in the P2P-mode (YES in S110), the CPU 32 proceeds to S112. When it is determined that the MFP 10 is to be operated in the R/W-mode (NO in S110), the CPU 32 proceeds to S160 shown in FIG. 5.

(Poll-Process of MFP; P2P-Mode (FIG. 4))

In S112, the CPU 32 sends the activation command corresponding to the P2P-mode to the portable device 50 via the NFC I/F 22. Next, in S114, the CPU 32 receives a response command (i.e., an OK command), responsive to the activation command, from the portable device 50 via the NFC I/F 22. As a result, an NFC scheme communication link is established between the MFP 10 and the portable device 50.

Next, in S116, the CPU 32 starts a confirming command sending process. In the confirming command sending process, the CPU 32 sends the confirming command to the portable device 50 via the NFC I/F 22 and receives a response command (i.e., an OK command), responsive to the confirming command, from the portable device 50 via the NFC I/F 22. Note that, once the CPU 32 starts the confirming command sending process in S116, the CPU 32 continues the execution of the confirming command sending process until S138 described hereinafter is executed or until the communication link is disconnected in S144 described hereinafter.

The steps S118 to S128 are same as S18 to S28 shown in FIG. 2. The steps S130 to S136 are same as S30 to S36 shown in FIG. 2. The step S140 is same as S40 shown in FIG. 2. In S142, the CPU 32 sends the deactivation command to the portable device 50 via the NFC I/F 22. Next, in S144, the CPU 32 receives a response command (i.e., an OK command), responsive to the deactivation command, from the portable device 50 via the NFC I/F 22. As a result, the communication link established in S114 is disconnected.

In S138, the CPU 32 executes a disconnecting process for disconnecting the communication link established in S114. Two methods can be considered as a method for the disconnecting process of S138: a software-based disconnecting process and a hardware-based disconnecting process. The CPU 32 may execute either one of the methods for the disconnecting process.

In a case where the CPU 32 executes the software-based disconnecting process, the CPU 32 sends a deactivation command to the portable device 50 via the NFC I/F 22 and receives a response command (i.e., an OK command) from the portable device 50 via the NFC I/F 22 responsive to the deactivation command. As a result, the communication link established in S114 is disconnected. The CPU 32 can appropriately disconnect the communication link by executing the software-based disconnecting process (sending the deactivation command and receiving the OK command).

Note that the software-based disconnecting process is not limited to the method of sending the deactivation command from the CPU 32 described above. For instance, the CPU 32 may end the confirming command sending process started in S116. In other words, the CPU 32 does not send the confirming command to the portable device 50. When not receiving the confirming command from the MFP 10 for a predetermined period of time, the portable device 50 determines this situation as a timeout. The portable device 50 consequently ends the process relating to the communication link (i.e., monitoring reception of the confirming command), resulting in disconnecting the communication link. This method is also an example of the software-based disconnecting process.

On the other hand, in a case where the CPU 32 executes the hardware-based disconnecting process, the CPU 32 temporarily stops the operations of the NFC I/F 22. More specifically, for example, the CPU 32 sends to the NFC I/F 22 an instruction for stopping the operations of the NFC I/F 22. The CPU 32, therefore, can no longer use the NFC I/F 22 to execute the confirming command responding process that is started in S116. In this case, the portable device 50 determines this situation as a timeout and ends the process relating to the communication link (i.e., monitoring reception of the confirming command), resulting in disconnecting the communication link. The CPU 32 can appropriately disconnect the communication link by executing the hardware-based disconnecting process (i.e., stopping the operations of the NFC I/F 22).

Note that the method of stopping the operations of the NFC I/F 22 is not limited to the method of sending the instruction from the CPU 32 to the NFC I/F 22 described above. For example, the CPU 32 may temporarily stop the operations of the NFC I/F 22 by temporarily stopping supplying power to the NFC I/F 22. This method is also an example of the hardware-based disconnecting process. Once S138 is ended, the Listen-process of MFP is ended.

(Poll-Process of MFP; R/W-Mode (FIG. 5))

Contents of processes that are executed when the result of S110 of FIG. 4 is determined as NO (when it is determined that the MFP 10 is to be operated in the R/W-mode) are described next with reference to FIG. 5. The steps S160 to S164 are same as S112, S114, and S118 shown in FIG. 4. In S160, however, the CPU 32 sends the activation command corresponding to the R/W-mode.

When the result of S164 is NO (i.e., when the sending flag is set at “0”), the CPU 32 determines in S165 that the MFP 10 is to be operated according to the Reader-mode. Accordingly, the CPU 32 can read the target data from the pseudo card of the portable device 50, that is, receive the target data from the portable device 50. The steps S166 to S172 that are executed subsequently are same as S66 to S72 shown in FIG. 3.

On the other hand, when the result of S164 is YES (i.e., when the sending flag is set at “1”), the CPU 32 determines in S173 that the MFP 10 is to be operated according to the Writer-mode. The CPU 32 therefore can write the target data into the pseudo card of the portable device 50, that is, send the target data to the portable device 50. The steps S174 to S182 that are executed subsequently are same as S74 to S82 shown in FIG. 3. Note that S186 to S190 are same as S140 to S144 shown in FIG. 4.

(Specific Cases)

Specific cases realized by the present embodiment are described next. Each of the following cases is realized by allowing the MFP 10 to execute each of the processes shown in FIGS. 2 to 5.

(Case A1; FIG. 6)

In the case A1, the MFP 10 executes the Listen-operation (i.e., the portable device 50 executes the Poll-operation) and the portable device 50 can be operated according to the P2P-mode.

The MFP 10 receives the activation command from the portable device 50 (S10 of FIG. 2) and sends an OK command to portable device 50 (S14). Consequently, a communication link L1 is established between the MFP 10 and the portable device 50. In this case, the MFP 10 starts the confirming command responding process (S16). In other words, the MFP 10 receives the confirming command from the portable device 50 and sends an OK command to the portable device 50.

In the case A1, the sending flag is set at “0” at the time of the establishment of the communication link L1. In this case, the MFP 10 determines that the result of S18 of FIG. 2 is NO, executes the negotiation subsequently, and then informs the portable device 50 of that the MFP 10 executes data reception (S20). The MFP 10 receives the first target data from the portable device 50 (S22) and generates the second target data by processing the first target data (S24). In this case, the MFP 10 sets the sending flag at “1” and the communication complete flag at “1” (S28).

Next, the MFP 10 executes the software-based disconnecting process (S38). In other words, the MFP 10 does not send an OK command even when receiving the confirming command from the portable device 50. In this case, the MFP 10 receives the deactivation command from the portable device 50 and sends an OK command to the portable device 50. As a result, the communication link L1 is disconnected.

Thereafter, the MFP 10 executes the Listen-operation again the portable device 50 executes the Poll-operation again). The MFP 10 receives the activation command from the portable device 50 (S10) and sends an OK command to the portable device 50 (S14). As a result, a communication link L2 is established between the MFP 10 and the portable device 50.

The sending flag is set at “1” when the first target data is communicated. In this case, the MFP 10 determines that the result of S18 of FIG. 2 is YES, executes the negotiation subsequently, and then informs the portable device 50 of that the MFP 10 executes data sending (S30). The MFP 10 sends the second target data to the portable device 50 (S32). In this case, the MFP 10 sets the sending flag at “0” and the communication complete flag at “0” (S40). The MFP 10 then receives the deactivation command from the portable device 50 (S42) and sends an OK command to the portable device 50 (S44). As a result, the communication link L2 is disconnected.

As described above, the P2P-mode is a mode for bidirectional communication. Therefore, considered is a configuration in which both the first and second target data are communicated using the same communication link L1. However, there is a possibility that the portable device 50 cannot appropriately execute bidirectional communication in accordance with the P2P-mode. For example, there is a possibility that an OS (Operating System) of the portable device 50 does not allow the operation of receiving the second target data using the same communication link L1 to be performed after sending the first target data by using the communication link L1.

In view of these possibilities, in the present embodiment, the MFP 10 disconnects the communication link L1 when receiving the first target data from the portable device 50 by using the communication link L1 corresponding to the P2P, as shown in the case A1. Subsequently, the MFP 10 reestablishes the communication link L2 corresponding to P2P and sends the second target data to the portable device 50 by using the communication link L2. Thus, even when the portable device 50 does not allow the execution of bidirectional communication according to the P2P-mode, the MFP 10 can appropriately communicate the first target data and the second target data with the portable device 50 in accordance with the P2P-mode, the second target data being generated by processing the first target data.

(Case A2; FIG. 7)

A case A2 is different from the case A1 in that the MFP 10 executes the hardware-based disconnecting process (S38 of FIG. 2) in place of the software-based disconnecting process.

In other words, the MFP 10 temporarily stops the operations of the NFC I/F 22 in the hardware-based disconnecting process. The MFP 10, therefore, does not send an OK command even when receiving the confirming command from the portable device 50. The MFP 10 also does not send an OK command even when receiving the deactivation command from the portable device 50. Consequently, the portable device 50 determines this situation as a timeout, resulting in disconnecting the communication link L1. The other points of the case A2 are same as those of the case A1. The same operations and effects as those of the case A1 can be obtained with the case A2 as well.

Note that the execution of the hardware-based disconnecting process for the case A2 might require a long time for the NFC I/F 22 to recover. Therefore, from the aspect of expediting the process, it is preferred that the software-based disconnecting process for the case A1 be executed. However, the hardware-based disconnecting process for the case A2 can reliably disconnect the communication link L1. Thus, from the aspect of accomplishing reliable disconnection of the communication link, it is preferred that the hardware-based disconnecting process for the case A2 be executed. With regard to the other cases as well (such as a case A4 shown in FIG. 4), either the software-based disconnecting process or the hardware-based disconnecting process may be adopted depending on the aspect valued by the vendor or manufacturer of the MFP 10.

(Case A3; FIG. 8)

In the case A3, the MFP 10 executes the Poll-operation (i.e., the portable device 50 executes the Listen-operation) and the portable device 50 can be operated according to the P2P-mode.

The MFP 10 sends the activation command to the portable device 50 (S112 of FIG. 4) and receives an OK command from the portable device 50 (S114). Consequently, a communication link L1 is established between the MFP 10 and the portable device 50.

In the case A3, the sending flag is set at “0” at the time of the establishment of the communication link L1. In this case, the MFP 10 determines that the result of S118 of FIG. 4 is NO, executes the negotiation subsequently, and then informs the portable device 50 of that the MFP 10 executes data reception (S120). The MFP 10 receives the first target data from the portable device 50 (S122) and generates the second target data by processing the first target data (S124). In this case, the MFP 10 sets the sending flag at “1” and the communication complete flag at “1” (S128).

Next, the MFP 10 executes the software-based disconnecting process (S138). In other words, the MFP 10 sends a deactivation command to the portable device 50 and receives an OK command from the portable device 50. As a result, the communication link L1 is disconnected.

Thereafter, the MFP 10 executes the Poll-operation again (i.e., the portable device 50 executes the Listen-operation again). The MFP 10 sends the activation command to the portable device 50 (S112) and receives an OK command from the portable device 50 (S114). As a result, a communication link L2 is established between the MFP 10 and the portable device 50.

The sending flag is set at “1” when the first target data is communicated. In this case, the MFP 10 determines that the result of S118 of FIG. 4 is YES, executes the negotiation subsequently, and then informs the portable device 50 of that the MFP 10 executes data sending (S130). The MFP 10 sends the second target data to the portable device 50 (S132). In this case, the MFP 10 sets the sending flag at “0” and the communication complete flag at “0” (S140). The MFP 10 then sends the deactivation command to the portable device 50 (S142) and receives an OK command from the portable device 50 (S 144). As a result, the communication link L2 is disconnected.

As well as with the case A3, the MFP 10 can appropriately communicate the first target data and the second target data with the portable device 50 in accordance with the P2P-mode, the second target data being generated by processing the first target data.

(Case A4; FIG. 9)

A case A4 is different from the case A3 in terms of the contents of the software-based disconnecting process. Note that, once the communication link L1 is established, the MFP 10 starts the confirming command sending process (S116). In other words, the MFP 10 sends the confirming command to the portable device 50 and receives an OK command from the portable device 50.

In the software-based disconnecting process for the case A3, the MFP 10 sends the deactivation command to the portable device 50 and receives an OK command from the portable device 50 (see FIG. 8). In the software-based disconnecting process for the case A4, on the other hand, the MFP 10 ends the confirming command sending process (S138). Accordingly, the portable device 50 determines this situation as a timeout, resulting in disconnecting the communication link L1. The other points are same as those of the case A3. The same operations and effects as those of the case A3 can be obtained with the case A4 as well.

As described above, the MFP 10 may execute the hardware-based disconnecting process for temporarily stopping the operations of the NFC I/F 22 (S138). In this case as well, because the confirming command is not sent to the portable device 50, the portable device 50 determines the situation as a timeout, resulting in disconnecting the communication link L1. This configuration can achieve the same operations and effects.

(Other Cases)

In the cases A1 to A4 shown in FIGS. 6 to 9, when establishing the first communication link L1 and when establishing the second communication link L2, the MFP 10 is operated as the same device (i.e., as the Listen device in FIGS. 6 and 7, and as the Poll device in FIGS. 8 and 9). However, for example, when establishing the first communication link L1 the MFP 10 may be operated as the Listen device, and when establishing the second communication link L2 the MFP 10 may be operated as the Poll device. Furthermore, for example, when establishing the first communication link L1 the MFP 10 may be operated as the Poll device, and when establishing the second communication link L2 the MFP 10 may be operated as the Listen device.

Moreover, in the cases A1 to A4 shown in FIGS. 6 to 9, the MFP 10 receives the first target data from the portable device 50 and sends the second target data to the portable device 50. In other words, the cases A1 to A4 correspond to the first to filth examples relating to the target data. However, the MFP 10 may send the first target data to the portable device 50 and receive the second target data from the portable device 50. In other words, the sixth example relating to the target data may be realized. In any of the cases the same operations and effects as those of the cases A1 to A4 can be obtained.

(Case B1; FIG. 10)

In the case B1, the MFP 10 executes the Listen-operation (i.e., the portable device 50 executes the Poll-operation) and the portable device 50 can be operated according to only the R/W mode and the CE-mode. Therefore, the MFP 10 is operated according to the CE-mode, and the portable device 50 is operated according to the R/W-mode.

The MFP 10 receives the activation command from the portable device 50 (S10 of FIG. 2) and sends an OK command to portable device 50 (S62). Consequently, a communication link L1 is established between the MFP 10 and the portable device 50.

In the case B1, the sending flag is set at “0” at the time of the establishment of the communication link L1. In this case, the MFP 10 determines that the result of S64 of FIG. 3 is NO, receives the first target data from the portable device 50 (S66) and generates the second target data by processing the first target data (S68). In this case, the MFP 10 sets the sending flag at “1” and the communication complete flag at “1” (S72).

Next, the MFP 10 executes the software-based disconnecting process (S80). In other words, the MFP 10 receives the deactivation command from the portable device 50 and sends an OK command to the portable device 50. As a result, the communication link L1 is disconnected.

Next, the MFP 10 executes the operation controlling process (S82). In other words, the MFP 10 does not send a response signal even when receiving a polling signal from the portable device 50 (i.e., the NFC I/F 22 does not execute the Listen-operation temporarily). The MFP 10 does not send a polling signal to the portable device 50 (i.e., the NFC I/F 22 does not execute the Poll-operation temporarily). Consequently, the portable device 50 detects secession of the MFP 10. As a result, even when the MFP 10 and the portable device 50 remain close to each other, the communication link L2 described hereinafter can appropriately be established.

Thereafter, the MFP 10 executes the Listen-operation again (i.e., the portable device 50 executes the Poll-operation again). The MFP 10 receives the activation command from the portable device 50 (S10 in FIG. 2) and sends an OK command to the portable device 50 (S62). As a result, a communication link L2 is established between the MFP 10 and the portable device 50.

The sending flag is set at “1” when the first target data is communicated. In this case, the MFP 10 determines that the result of S64 of FIG. 3 is YES and sends the second target data to the portable device 50 (S74). In this case, the MFP 10 sets the sending flag at “0” and the communication complete flag at “0” (S86). The MFP 10 then receives the deactivation command from the portable device 50 (S88) and sends an OK command to the portable device 50 (S90). As a result, the communication link. L2 is disconnected.

As described above, the R/W-mode and the CE-mode are the modes for unidirectional communication. Thus, both the first and second target data cannot be communicated using the same communication link L1. In the present embodiment, when the MFP 10 receives the first target data from the portable device 50 by using the communication link L1, as shown in the case B1, the communication link L1 is disconnected. Next, the MFP 10 reestablishes the communication link L2 and sends the second target data to the portable device 50 by using the communication link L2. Therefore, even when the MFP 10 and the portable device 50 are operated according to the R/W-mode and the CE-mode, the MFP 10 can appropriately communicate the first target data and the second target data with the portable device 50, the second target data being generated by processing the first target data. In other words, the MFP 10 can realize pseudo bidirectional communication.

(Case B2; FIG. 11)

In the case B1, the MFP 10 executes the Poll-operation (i.e., the portable device 50 executes the Listen-operation) and the portable device 50 can be operated according to only the R/W mode and the CE-mode. Therefore, the MFP 10 is operated according to the R/W-mode and the portable device 50 is operated according to the CE-mode.

The MFP 10 sends the activation command to the portable device 50 (S160 of FIG. 5) and receives an OK command from portable device 50 (S162). Consequently, a communication link L1 is established between the MFP 10 and the portable device 50.

In the case B2, the sending flag is set at “0” at the time of the establishment of the communication link L1. In this case, the MFP 10 determines that the result of S164 of FIG. 5 is NO and determines that the MFP 10 is to be operated according to the Reader-mode (S165). The MFP 10 receives the first target data from the portable device 50 (S166) and generates the second target data by processing the first target data (S168). In this case, the MFP 10 sets the sending flag at “1” and the communication complete flag at “1” (S172).

Next, the MFP 10 executes the software-based disconnecting process (S180). In other words, the MFP 10 sends the deactivation command to the portable device 50 and receives an OK command from the portable device 50. As a result, the communication link L1 is disconnected.

Next, the MFP 10 executes the operation controlling process (S182). Consequently, the portable device 50 detects a secession of the MFP 10. Thereafter, the MFP 10 executes the Poll-operation again (i.e., the portable device 50 executes the Listen-operation again). The MFP 10 sends the activation command to the portable device 50 (S160) and receives an OK command from the portable device 50 (S162). As a result, a communication link L2 is established between the MFP 10 and the portable device 50.

The sending flag is set at “1” when the first target data is communicated. In this case, the MFP 10 determines that the result of S164 of FIG. 5 is YES and determines that the MFP 10 is to be operated according to the Writer-mode (S173). The MFP 10 sends the second target data to the portable device 50 (S174). In this case, the MFP 10 sets the sending flag at “0” and the communication complete flag at “0” (S186). The MFP 10 then sends the deactivation command to the portable device 50 (S188) and receives an OK command from the portable device 50 (S190). As a result, the communication link L2 is disconnected.

The same operations and effects as those of the case B1 can be obtained with the case B2 as well. In other words, even when the MFP 10 and the portable device 50 are operated according to the R/W-mode and the CE-mode, the MFP 10 can realize pseudo bidirectional communication.

(Other Cases)

In the cases B1 and B2 shown in FIGS. 10 and 11, when establishing the first communication link L1 and when establishing the second communication link L2, the MFP 10 is operated as the same device (i.e., the Listen device in FIG. 10, the Poll device in FIG. 11). However, for example, as shown in the case B3 of FIG. 12, when establishing the first communication link L1 the MFP 10 may be operated as the Listen device (i.e., CE-Mode), and when establishing the second communication link L2 the MFP 10 may be operated as the Poll device (i.e., Writer-Mode). Furthermore, for example, as shown in the case B4 of FIG. 12, when establishing the first communication link L1 the MFP 10 may be operated as the Poll device (i.e., Reader-Mode), and when establishing the second communication link L2 the MFP 10 may be operated as the Listen device (i.e., CE-Mode).

Moreover, in, the cases B1 and B2 shown in FIGS. 10 and 11, the MFP 10 receives the first target data from the portable device 50 and sends the second target data to the portable device 50. In other words, the cases B1 and B2 correspond to the first to fifth examples relating to the target data. However, as shown in the cases B5 to B8 of FIG. 12, the MFP 10 may send the first target data to the portable device 50 and receive the second target data from the portable device 50. In other words, the sixth example relating to the target data may be realized. In any of the cases the same operations and elects as those of the cases B1 and B2 can be obtained.

(Corresponding Relationship)

The MFP 10 is an example of “a communication device”. The portable device 50 is an example of “an external device”. The activation command is an example of “a first establishing command” and “a second establishing command”. The deactivation command is an example of “a disconnecting command”. The sending flag=1 is an example of “sending information”. In the cases A1 to A4 of FIGS. 6 to 9, the P2P-mode is an example of “a sending-mode” and “a receiving-mode”. In the case B1 of FIG. 10, the CE-mode is an example of “a sending-mode”and “a receiving-mode”. In the case B2 of FIG. 11, the Writer-mode is an example of “a sending-mode”. In the case B2 of FIG. 11, the Reader-mode is an example of “a receiving-mode”.

S10 and S14 of FIG. 2, S62 of FIG. 3, S112 and S114 of FIG. 4, and S160 and S162 of FIG. 5 are examples of “a first establishing step (and a first establishing module)” and “a second establishing step (and a second establishing module)”. S22 and S32 of FIG. 2, S66 and S74 of FIG. 3, S122 and S132 of FIG. 4, and S166 and S174 of FIG. 5 are examples of “a first communicating step (and a first communicating module)” and “a second communicating step (and a second communicating module)”. S38 of FIG. 2, S80 of FIG. 3, S138 of FIG. 4, and S180 of FIG. 5 are examples of “a disconnecting step (and a disconnecting module)”. S38 of FIG. 2 is an example of “a first disconnecting method”. S138 of FIG. 4 is an example of “a second disconnecting method”. S80 of FIG. 3 is an example of “a first disconnecting method”. S180 of FIG. 5 is an example of “a second disconnecting method”.

A confirming command responding process started at S16 of FIG. 2 is an example of “a first confirming step”. A confirming command sending process started at S116 of FIG. 4 is an example of “a second confirming step”. S82 of FIG. 3 and S182 of FIG. 5 are examples of “an operation controlling step”. S18 of FIG. 2, S64 of FIG. 3, S118 of FIG. 4 and S164 of FIG. 5 are examples of “a determining step”. S28 and S36 of FIG. 2, S72 and S78 of FIG. 3, S128 and S136 of FIG. 4 and S172 and S178 of FIG. 5 are examples of “a memory controlling step”. S20 of FIG. 2 and S120 of FIG. 4 are examples of “an informing step”. S165 and S173 of FIG. 5 are examples of “a deciding step”. S24 of FIG. 2, S68 of FIG. 3, S124 of FIG. 4 and S168 of FIG. 5 are examples of “a processing step”. S22 of FIG. 2, S66 of FIG. 3, S122 of FIG. 4 and S166 of FIG. 5 are examples of “a receiving step”. S32 of FIG. 2, S74 of FIG. 3, S132 of FIG. 4 and S174 of FIG. 5 are examples of “a sending step”.

While specific embodiments of the present invention have been described in detail above, such description is for illustrative purposes only and is not intended to limit the scope and claims of the invention. Techniques described in the claims of the invention include various modifications and changes made to the specific examples illustrated above. Modifications according to the above embodiments are listed below.

(Modification 1)

The “communication device” is not limited to the multi-function peripheral (i.e., the MFP 10) capable of executing the printing function and the scanning function, and, therefore, may be a printer capable of executing only the printing function out of the printing function and the scanning function or may be a scanner capable of executing only the scanning function out of the printing function and the scanning function. The “communication device” may be a device that executes a function different from the printing function and the scanning function (e.g., an image display function, a data calculation function) (e.g., a PC, server, portable terminal (cellular phone, smartphone, PDA, etc.)). In other words, the “communication device” includes various devices capable of executing the NFC scheme communications.

(Modification 2)

The MFP 10 may not be able to use the P2P-mode and may be capable of using only the RAW-mode and the CE-mode. In this case, the CPU 32 may execute each of the processes shown in FIGS. 3 and 5 without executing the processes shown in FIGS. 2 and 4. Furthermore, the MFP 10 may not be able to use the R/W-mode and the CE-mode and may be capable of using only the P2P-mode. In other words, the “communication device” may not be able to use all of the modes complying with the NFC standard and may be capable of using at least one of the modes.

(Modification 3)

In each of the embodiments described above, each of the processes shown in FIGS. 2 to 5 is realized by the software (i.e., the programs 36, 38), but at least one of the processes shown in FIGS. 2 to 5 may be realized by hardware such as a logic circuit.

(Modification 4)

In the foregoing embodiment, a print executing unit 18 and a scan executing unit 20 are realized as a result of the controller 30 executing the processes according to the program in a memory 34. Nevertheless, at least one unit of respective units 18 and 20 may alternately be realized by a hardware resource such as a logic circuit. 

What is claimed is:
 1. A communication device configured to communicate target data that is a target of communication with an external device according to an NFC (an abbreviation of Near Field Communication) scheme, the NFC scheme being a scheme complying with an NFC standard, the communication device comprising: an NFC interface configured to execute NFC scheme communication; a processor; and a memory configured to store a computer program, wherein, according to the computer program, the processor is configured to execute: a first establishing step that communicates a first establishing command with the external device via the NFC interface so as to establish a first communication link between the communication device and the external device; a first communicating step that communicates first target data with the external device via the NFC interface by using the first communication link; a disconnecting step that disconnects the first communication link after communicating the first target data with the external device; a second establishing step that communicates a second establishing command with the external device via the NFC interface after disconnecting the first communication link, so as to establish a second communication link between the communication device and the external device; and a second communicating step that communicates second target data with the external device via the NFC interface by using the second communication link, the second target data being data generated by processing the first target data.
 2. The communication device as in claim 1, wherein in a case where the NFC interface executes a Listen-operation, the first establishing step includes a step that receives the first establishing command, the Listen-operation is an operation in which the NFC interface receives a polling signal from the external device and sends a response signal responsive to the polling signal to the external device, and in a case where the NFC interface executes a Poll-operation, the first establishing step includes a step that sends the first establishing command, the Poll-operation is an operation in which the NFC interface sends a polling signal to the external device and receives a response signal responsive to the polling signal from the external device.
 3. The communication device as in claim 1, wherein in a first case where the first establishing command is received from the external device in the first establishing step, the disconnecting step includes a step that disconnects the first communication link by using a first disconnecting method, and in a second case where the first establishing command is sent to the external device in the first establishing step, the disconnecting step includes a step that disconnects the first communication link by using a second disconnecting method which is different from the first disconnecting method.
 4. The communication device as in claim 1, wherein the first communication link is a communication link for each of the communication device and the external device to communicate according to a P2P-mode of the NFC standard.
 5. The communication device as in claim 1, wherein the first communicating step includes a step that sends the first target data to the external device by using the first communication link, and the second communicating step includes a step that receives the second target data from the external device by using the second communication link.
 6. The communication device as in claim 1, wherein the first communicating step includes a step that receives the first target data from the external device by using the first communication link, and the second communicating step includes a step that sends the second target data to the external device by using the second communication link.
 7. The communication device as in claim 4, wherein according to the computer program, the processor is configured to further execute: a first confirming step that receives a confirming command from the external device via the NFC interface while the first communication link is established, so as to send a response commend responsive to the confirming commend to the external device via the NFC interface, in a first case where the first establishing command is received from the external device in the first establishing step, the confirming command being a command to confirm whether or not the first communication link is maintained, wherein in the first case, the disconnecting step includes a step that stops execution of the first confirming step, and then receives a disconnecting command for disconnecting the first communication link from the external device via the NFC interface, so as to send a response command responsive to the disconnecting command to the external device via the NFC interface.
 8. The communication device as in claim 4, wherein in a first case where the first establishing command is received from the external device in the first establishing step, the disconnecting step includes a step that temporarily stops an operation of the NFC interface.
 9. The communication device as in claim 4, wherein in a second case where the first establishing command is sent to the external device in the first establishing step, the disconnecting step includes a step that sends a disconnecting command for disconnecting the first communication link to the external device via the NFC interface, so as to receive a response command responsive to the disconnecting command from the external device via the NFC interface.
 10. The communication device as in claim 4, wherein according to the computer program, the processor is configured to further execute: a second confirming step that sends a confirming command to the external device via the NFC interface while the first communication link is established, so as to receive a response command responsive to the confirming command from the external device via the NFC interface, in a second case where the first establishing command is sent to the external device in the first establishing step, the confirming command being a command to confirm whether or not the first communication link is maintained, wherein in the second case, the disconnecting step includes a step that stops execution of the second confirming step.
 11. The communication device as in claim 1, wherein the first communication link is a communication link for one of the communication device and the external device to communicate according to a Reader/Writer-mode of the NFC standard, and for the other of the communication device and the external device to communicate according to a Card Emulation-mode of the NFC standard.
 12. The communication device as in claim 11, wherein in a first case where the first establishing command is received from the external device in the first establishing step, the disconnecting step includes a step that receives a disconnecting command for disconnecting the first communication link from the external device via the NFC interface, so as to sends a response command responsive to the disconnecting command to the external device via the NFC interface.
 13. The communication device as in claim 11, wherein in a second case where the first establishing command is sent to the external device in the first establishing step, the disconnecting step includes a step that sends a disconnecting command for disconnecting the first communication link to the external device via the NFC interface, so as to receive a response command responsive to the disconnecting command from the external device via the NFC interface.
 14. The communication device as in claim 11, wherein the NFC interface executes a Listen-operation in which the NFC interface receives a polling signal from the external device and sends a response signal responsive to the polling signal to the external device, and according to the computer program, the processor is configured to further execute: an operation controlling step that controls an operation of the NFC interface so that the NFC interface does not execute the Listen-operation over a predetermined period of time after the disconnecting step is executed.
 15. The communication device as in claim 11, wherein the NFC interface executes a Poll-operation in which the NFC interface sends a polling signal to the external device and receives a response signal responsive to the polling signal from the external device, and according to the computer program, the processor is configured to further execute: an operation controlling step that controls an operation of the NFC interface so that the NFC interface does not execute the Poll-operation over a predetermined period of time after the disconnecting step is executed.
 16. The communication device as in claim 11, wherein in a case where the communication device is to receive the first target data from the external device: the first establishing step includes a step that establishes the first communication link that is a communication link for the communication device to communicate according to a Card Emulation-mode of the NFC standard and for the external device to communicate according to a Writer-mode of the NFC standard; the first communicating step includes a step that receives the first target data from the external device by using the first communication link; the second establishing step includes a step that establishes the second communication link that is a communication link for the communication device to communicate according to the Writer-mode of the NFC standard and for the external device to communicate according to the Card Emulation-mode of the NFC standard; and the second communicating step includes a step that sends the second target data to the external device by using the second communication link.
 17. The communication device as in claim 11, wherein in a case where the communication device is to receive the first target data from the external device: the first establishing step includes a step that establishes the first communication link that is a communication link for the communication device to communicate according to a Card Emulation-mode of the NFC standard and for the external device to communicate according to a Reader-mode of the NFC standard; the first communicating step includes a step that sends the first target data to the external device by using the first communication link; the second establishing step includes a step that establishes the second communication link that is a communication link for the communication device to communicate according to the Reader-mode of the NFC standard and for the external device to communicate according to the Card Emulation-mode of the NFC standard; and the second communicating step includes a step that receives the second target data from the external device by using the second communication link.
 18. The communication device as in claim 11, wherein in a case where the communication device is to receive the first target data from the external device: the first establishing step includes a step that establishes the first communication link that is a communication link for the communication device to communicate according to a Reader-mode of the NFC standard and for the external device to communicate according to a Card Emulation-mode of the NFC standard; the first communicating step includes a step that receives the first target data from the external device by using the first communication link; the second establishing step includes a step that establishes the second communication link that is a communication link for the communication device to communicate according to a Writer-mode of the NFC standard and for the external device to communicate according to the Card Emulation-mode of the NFC standard; and the second communicating step includes a step that sends the second target data to the external device by using the second communication link.
 19. The communication device as in claim 11, wherein in a case where the communication device is to receive the first target data from the external device: the first establishing step includes a step that establishes the first communication link that is a communication link for the communication device to communicate according to a Reader-mode of the NFC standard and for the external device to communicate according to a Card Emulation-mode of the NFC standard; the first communicating step includes a step that receives the first target data from the external device by using the first communication link; the second establishing step includes a step that establishes the second communication link that is a communication link for the communication device to communicate according to the Card Emulation-mode of the NFC standard and for the external device to communicate according to the Reader-mode of the NFC standard; and the second communicating step includes a step that sends the second target data to the external device by using the second communication link.
 20. The communication device as in claim 11, wherein in a case where the communication device is to receive the first target data from the external device; the first establishing step includes a step that establishes the first communication link that is a communication link for the communication device to communicate according to a Writer-mode of the NFC standard and for the external device to communicate according to a Card Emulation-mode of the NFC standard; the first communicating step includes a step that sends the first target data to the external device by using the first communication link; the second establishing step includes a step that establishes the second communication link that is a communication link for the communication device to communicate according to a Reader-mode of the NFC standard and thr the external device to communicate according to the Card Emulation-mode of the NFC standard; and the second communicating step includes a step that receives the second target data from the external device by using the second communication link.
 21. The communication device as in claim 11, wherein in a case where the communication device is to receive the first target data from the external device: the first establishing step includes a step that establishes the first communication link that is a communication link for the communication device to communicate according to a Writer-mode of the NFC standard and for the external device to communicate according to a Card Emulation-mode of the NFC standard; the first communicating step includes a step that sends the first target data to the external device by using the first communication link; the second establishing step includes a step that establishes the second communication link that is a communication link for the communication device to communicate according to the Card Emulation-mode of the NFC standard and for the external device to communicate according to the Writer-mode of the NFC standard; and the second communicating step includes a step that receives the second target data from the external device by using the second communication link.
 22. The communication device as in claim 1, wherein according to the computer program, the processor is configured to further execute: a determining step that determines whether or not sending information indicating that data sending is to be executed is stored in the memory, when the first target data is to be communicated with the external device, in a case where it is determined in the determining step that the sending information is stored in the memory, the first communicating step includes a step that sends the first target data to the external device by using the first communication link, wherein the first target data is to be communicated with the external device, in a case where it is determined in the determining step that the sending information is not stored in the memory, the first communicating step includes a step that receives the first target data from the external device by using the first communication link, when the second target data is to be communicated with the external device, in a case where it is determined in the determining step that the sending information is stored in the memory, the second communicating step includes a step that sends the second target data to the external device by using the second communication link, and when the second target data is to be communicated with the external device, in a case where it is determined in the determining step that the sending information is not stored in the memory, the second communicating step includes a step that receives the second target data from the external device by using the second communication link.
 23. The communication device as in claim 22, wherein when the first target data is to be communicated with the external device, in the case where it is determined in the determining step that the sending information is stored in the memory, the first establishing step includes a step that establishes the first communication link that complies with a sending-mode for the communication device to execute data sending, when the first target data is to be communicated with the external device, in the case where it is determined in the determining step that the sending information is not stored in the memory, the first establishing step includes a step that establishes the first communication link that complies with a receiving-mode for the communication device to execute data reception, when the second target data is to be communicated with the external device, in the case where it is determined in the determining step that the sending information is stored in the memory, the second establishing step includes a step that establishes the second communication link that complies with the sending-mode, and when the second target data is to be communicated with the external device, in the case where it is determined in the determining step that the sending information is not stored in the memory, the second establishing step includes a step that establishes the second communication link that complies with the receiving mode.
 24. The communication device as in claim 22, wherein according to the computer program, the processor is configured to further execute a memory controlling step, the memory controlling step: erases the sending information from the memory in a case where the first target data is sent to the external device in the first communicating step; and stores the sending information in the memory in a case where the first target data is received from the external device in the first communicating step.
 25. The communication device as in claim 22, wherein according to the computer program, the processor is configured to further execute an informing step, the informing step: informs the external device that the communication device is to execute data sending, in a case where the communication device is to be operated according to a P2P-mode of the NFC standard, and it is determined in, the determining step that the sending information is stored in the memory; and informs the external device that the communication device is to execute data receiving, in a ease where the communication device is to be operated according to the P2P-mode of the NFC standard, and it is determined in the determining step that the sending information is not stored in the memory.
 26. The communication device as in claim 22, wherein according to the computer program, the processor is configured to further execute a deciding step, the deciding step: decides that the communication device is to be operated according to a Writer-mode, in a case where the communication device is to be operated according to a Reader/Writer-mode of the NFC standard, and it is determined in the determining step that the sending information is stored in the memory; and decides that the communication device is to be operated according to a Reader-mode, in a case where the communication device is to be operated according to the Reader/Writer-mode of the NFC standard, and it is determined in the determining step that the sending information is not stored in the memory.
 27. The communication device as in claim 1, wherein according to the computer program, the processor is configured to further execute: a processing step that generates the second target data by processing the first target data in a case where the first target data is received from the external device in the first communicating step.
 28. A communication device configured to communicate target data that is a target of communication with an external device according to an NFC (an abbreviation of Near Field Communication) scheme, the NFC scheme being a scheme complying with an NFC standard, the communication device comprising: a first establishing module configured to communicate a first establishing command with the external device so as to establish a first communication link complying with the NFC scheme between the communication device and the external device; a first communicating module configured to communicate first target data with the external device by using the first communication link; a disconnecting module configured to disconnect the first communication link after communicating the first target data with the external device; a second establishing module configured to communicate a second establishing command with the external device after disconnecting the first communication link, so as to establish a second communication link between the communication device and the external device; and a second communicating module configured to communicate second target data with the external device by using the second communication link, the second target data being data generated by processing the first target data.
 29. A communication device configured to communicate target data that is a target of communication with an external device according to an NFC (an abbreviation of Near Field Communication) scheme, the NFC scheme being a scheme complying with an NFC standard, the communication device comprising: an NFC interface configured to execute NFC scheme communication; a processor; and a memory configured to store a computer program, wherein, according to the computer program, the processor is configured to execute: a determining step that determines whether or not sending information indicating that data sending is to be executed is stored in the memory in a case where an establishing command, which is a command for establishing a communication link between the communication device and the external device, is communicated with the external device via the NFC interface, a receiving step that receives first target data from the external device via the NFC interface in a case where it is determined in the determining step that the sending information is not stored in the memory, a processing step that generates the second target data by processing the first target data in a case where the first target data is received from the external device, a memory controlling step that stores the sending information in the memory in the case where the first target data is received from the external device, a disconnecting step that disconnects the communication link after receiving the first target data from the external device, and a sending step that sends second target data to the external device via the NFC interface in a case where it is determined in the determining step that the sending information is stored in the memory.
 30. A non-transitory computer-readable storage medium storing a computer program for a communication device configured to communicate target data that is a target of communication with an external device according to an NFC (an abbreviation of Near Field Communication) scheme complying with an NFC standard, the computer program including instructions for ordering a processor mounted on the communication device to execute: a determining step that determines whether or not sending information indicating that data sending is to be executed is stored in the memory in a case where an establishing command, which is a command for establishing a communication link between the communication device and the external device, is communicated with the external device via the NFC interface, a receiving step that receives first target data from the external device via the NFC interface in a case where it is determined in the determining step that the sending information is not stored in the memory, a processing step that generates the second target data by processing the first target data in a case where the first target data is received from the external device, a memory controlling step that stores the transmission information in the memory the case where the first target data is received from the external device, a disconnecting step that disconnects the communication link after receiving the first target data from the external device, and a sending step that sends second target data to the external device via the NFC interface in a ease where it is determined in the determining step that the sending information is stored in the memory. 